﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
///Admins 的摘要说明
/// </summary>
public partial class Admins
{
    DataTableDataContext db = new DataTableDataContext();
    //根据ID查找managerName
    public IEnumerable<Admins> GetAdminByName(string name)
    {
        var user = from d in db.Admins where d.managerName == name select d;
        return user;
    }
    //创建管理员
    public void CreateAdmins(string name, string password)
    {
        Admins ad = new Admins {managerName=name,pwd=password };
        db.Admins.InsertOnSubmit(ad);
        db.SubmitChanges();
    }

    //返回所有的管理员
    public IEnumerable<Admins> GetAllAdmins()
    {
        var admins = from ad in db.Admins select ad;
        return admins;
    }
   
}